package solutions.leetcode.easy;

import solutions.lib.BaseSolution;

import java.util.HashSet;
import java.util.Set;

/**
 * @author lizhidong
 * <a href="https://leetcode-cn.com/problems/distribute-candies/">575. 分糖果</a>
 */
public class Solution575 extends BaseSolution {

    public int distributeCandies(int[] candyType) {
        Set<Integer> set = new HashSet<>();
        for (int v : candyType) {
            set.add(v);
        }
        return Math.min(set.size(), candyType.length / 2);
    }

    public static void main(String[] args) {
        Solution575 solution = new Solution575();
    }
}